inherited fmClassJournal: TfmClassJournal
  Left = 912
  Top = 124
  Width = 738
  Height = 539
  Caption = 'fmClassJournal'
  PixelsPerInch = 96
  TextHeight = 13
  inherited sbBottom: TStatusBar
    Top = 485
    Width = 730
  end
  inherited Panel1: TPanel
    Width = 730
    Visible = False
    inherited BitBtn1: TBitBtn
      Left = 547
    end
    inherited BitBtn2: TBitBtn
      Left = 635
    end
  end
  object pThemes: TPanel [2]
    Left = 378
    Top = 71
    Width = 352
    Height = 414
    Align = alRight
    BevelOuter = bvNone
    TabOrder = 2
    object pcTheme: TPageControl
      Left = 0
      Top = 0
      Width = 352
      Height = 414
      ActivePage = tsTList
      Align = alClient
      Style = tsFlatButtons
      TabOrder = 0
      OnChange = pcThemeChange
      object tsTList: TTabSheet
        Caption = #1058#1077#1084#1099' '#1091#1088#1086#1082#1086#1074
        object gTheme: TcxGrid
          Left = 0
          Top = 26
          Width = 344
          Height = 357
          Align = alClient
          BevelOuter = bvNone
          BorderWidth = 6
          TabOrder = 0
          object vTheme: TcxGridBandedTableView
            NavigatorButtons.ConfirmDelete = False
            FilterBox.Visible = fvNever
            OnCustomDrawCell = vThemeCustomDrawCell
            OnFocusedRecordChanged = vThemeFocusedRecordChanged
            DataController.Summary.DefaultGroupSummaryItems = <>
            DataController.Summary.FooterSummaryItems = <
              item
                Kind = skCount
              end>
            DataController.Summary.SummaryGroups = <>
            OptionsBehavior.CellHints = True
            OptionsCustomize.ColumnFiltering = False
            OptionsCustomize.ColumnGrouping = False
            OptionsCustomize.ColumnHidingOnGrouping = False
            OptionsCustomize.ColumnHorzSizing = False
            OptionsCustomize.ColumnMoving = False
            OptionsCustomize.ColumnSorting = False
            OptionsCustomize.BandMoving = False
            OptionsCustomize.BandSizing = False
            OptionsCustomize.ColumnVertSizing = False
            OptionsData.CancelOnExit = False
            OptionsData.DeletingConfirmation = False
            OptionsData.Inserting = False
            OptionsSelection.HideFocusRectOnExit = False
            OptionsView.ColumnAutoWidth = True
            OptionsView.GroupByBox = False
            OptionsView.Header = False
            Styles.Content = DMInv.cxData
            Styles.IncSearch = DMInv.cxKrasniyText
            Styles.Selection = DMInv.cxJoltiyFon
            Styles.Header = DMInv.cxSiniyText
            Bands = <
              item
                Caption = #1058#1077#1084#1072' '#1091#1088#1086#1082#1072
                Width = 250
              end
              item
                Caption = #1044#1072#1090#1072
                Width = 75
              end>
            object cTPID: TcxGridBandedColumn
              DataBinding.ValueType = 'Integer'
              Visible = False
              VisibleForCustomization = False
              Position.BandIndex = 0
              Position.ColIndex = 1
              Position.RowIndex = 0
            end
            object cTheme: TcxGridBandedColumn
              Options.Editing = False
              Position.BandIndex = 0
              Position.ColIndex = 0
              Position.RowIndex = 0
            end
            object cTDate: TcxGridBandedColumn
              DataBinding.ValueType = 'DateTime'
              PropertiesClassName = 'TcxDateEditProperties'
              Properties.SaveTime = False
              Properties.ShowTime = False
              Properties.OnValidate = cTDatePropertiesValidate
              Position.BandIndex = 1
              Position.ColIndex = 0
              Position.RowIndex = 0
            end
          end
          object cxGridLevel2: TcxGridLevel
            GridView = vTheme
          end
        end
        object pBot: TPanel
          Left = 0
          Top = 0
          Width = 344
          Height = 26
          Align = alTop
          BevelOuter = bvNone
          TabOrder = 1
          object dxBarDockControl1: TdxBarDockControl
            Left = 0
            Top = 0
            Width = 344
            Height = 26
            Align = dalTop
            BarManager = bmgr
          end
        end
      end
      object tsPlan: TTabSheet
        Caption = #1055#1083#1072#1085
        ImageIndex = 1
        object gPlanLesson: TcxGrid
          Left = 0
          Top = 0
          Width = 344
          Height = 383
          Align = alClient
          BevelOuter = bvNone
          BorderWidth = 6
          TabOrder = 0
          object vPlanLesson: TcxGridTableView
            NavigatorButtons.ConfirmDelete = False
            FilterBox.Visible = fvNever
            OnCustomDrawCell = vPlanLessonCustomDrawCell
            OnFocusedRecordChanged = vPlanLessonFocusedRecordChanged
            DataController.Summary.DefaultGroupSummaryItems = <>
            DataController.Summary.FooterSummaryItems = <
              item
                Kind = skCount
                VisibleForCustomization = False
              end
              item
                Kind = skCount
                Column = cKurs
              end>
            DataController.Summary.SummaryGroups = <>
            DataController.OnRecordChanged = vPlanLessonDataControllerRecordChanged
            OptionsBehavior.CellHints = True
            OptionsBehavior.IncSearch = True
            OptionsCustomize.ColumnFiltering = False
            OptionsCustomize.ColumnGrouping = False
            OptionsData.Deleting = False
            OptionsData.DeletingConfirmation = False
            OptionsData.Inserting = False
            OptionsSelection.HideFocusRectOnExit = False
            OptionsSelection.UnselectFocusedRecordOnExit = False
            OptionsView.ColumnAutoWidth = True
            OptionsView.Footer = True
            OptionsView.FooterAutoHeight = True
            OptionsView.GroupByBox = False
            Styles.Content = DMInv.cxData
            Styles.IncSearch = DMInv.cxKrasniyText
            Styles.Selection = DMInv.cxJoltiyFon
            Styles.Header = DMInv.cxSiniyText
            object cKID: TcxGridColumn
              Caption = #1048#1076#1077#1085#1090#1080#1092#1080#1082#1072#1090#1086#1088
              DataBinding.ValueType = 'Integer'
              Visible = False
              VisibleForCustomization = False
              Width = 25
            end
            object cKurs: TcxGridColumn
              Caption = #1059#1095#1077#1073#1085#1099#1081' '#1082#1091#1088#1089
              Visible = False
              Options.Editing = False
              VisibleForCustomization = False
              Width = 55
            end
            object cTID: TcxGridColumn
              Caption = #1048#1076#1077#1085#1090#1080#1092#1080#1082#1072#1090#1086#1088
              DataBinding.ValueType = 'Integer'
              Visible = False
              VisibleForCustomization = False
              Width = 25
            end
            object cTema: TcxGridColumn
              Caption = #1058#1077#1084#1072
              Options.Editing = False
              Width = 55
            end
            object cPID: TcxGridColumn
              Caption = #1048#1076#1077#1085#1090#1080#1092#1080#1082#1072#1090#1086#1088
              DataBinding.ValueType = 'Integer'
              Visible = False
              VisibleForCustomization = False
              Width = 25
            end
            object cPodtema: TcxGridColumn
              Caption = #1059#1088#1086#1082
              Options.Editing = False
              Width = 80
            end
            object cDate: TcxGridColumn
              Caption = #1044#1072#1090#1072' '#1091#1088#1086#1082#1072
              DataBinding.ValueType = 'DateTime'
              PropertiesClassName = 'TcxDateEditProperties'
              Width = 25
            end
          end
          object glGrid1Level1: TcxGridLevel
            GridView = vPlanLesson
          end
        end
      end
    end
  end
  object gKids: TcxGrid [3]
    Left = 0
    Top = 71
    Width = 378
    Height = 414
    Align = alClient
    BorderWidth = 6
    TabOrder = 7
    object vKids: TcxGridBandedTableView
      NavigatorButtons.ConfirmDelete = False
      FilterBox.Visible = fvNever
      OnCustomDrawCell = vKidsCustomDrawCell
      OnFocusedItemChanged = vKidsFocusedItemChanged
      DataController.Summary.DefaultGroupSummaryItems = <>
      DataController.Summary.FooterSummaryItems = <
        item
          Kind = skCount
          Column = ckFIO
        end>
      DataController.Summary.SummaryGroups = <>
      DataController.OnRecordChanged = vKidsDataControllerRecordChanged
      OptionsBehavior.CellHints = True
      OptionsCustomize.ColumnFiltering = False
      OptionsCustomize.ColumnGrouping = False
      OptionsCustomize.ColumnHidingOnGrouping = False
      OptionsCustomize.ColumnHorzSizing = False
      OptionsCustomize.ColumnMoving = False
      OptionsCustomize.ColumnSorting = False
      OptionsCustomize.BandMoving = False
      OptionsCustomize.BandSizing = False
      OptionsCustomize.ColumnVertSizing = False
      OptionsData.CancelOnExit = False
      OptionsData.Deleting = False
      OptionsData.DeletingConfirmation = False
      OptionsData.Inserting = False
      OptionsSelection.HideFocusRectOnExit = False
      OptionsView.Footer = True
      OptionsView.GroupByBox = False
      Styles.Content = DMInv.cxData
      Styles.IncSearch = DMInv.cxKrasniyText
      Styles.Selection = DMInv.cxJoltiyFon
      Styles.Header = DMInv.cxSiniyText
      OnColumnHeaderClick = vKidsColumnHeaderClick
      Bands = <
        item
          Caption = #1044#1072#1090#1072
          FixedKind = fkLeft
          HeaderAlignmentHorz = taRightJustify
          Options.Moving = False
          Width = 120
        end>
      object ckPID: TcxGridBandedColumn
        Caption = 'ID'
        DataBinding.ValueType = 'Integer'
        Visible = False
        Options.Editing = False
        VisibleForCustomization = False
        Position.BandIndex = 0
        Position.ColIndex = 0
        Position.RowIndex = 0
      end
      object ckFIO: TcxGridBandedColumn
        Caption = #1060#1048#1054' '#1091#1095#1072#1097#1077#1075#1086#1089#1103
        PropertiesClassName = 'TcxTextEditProperties'
        Options.Editing = False
        Position.BandIndex = 0
        Position.ColIndex = 1
        Position.RowIndex = 0
      end
    end
    object cxGridLevel1: TcxGridLevel
      GridView = vKids
    end
  end
  object bmgr: TdxBarManager
    AllowReset = False
    AutoDockColor = False
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = []
    CanCustomize = False
    Categories.Strings = (
      #1055#1086' '#1091#1084#1086#1083#1095#1072#1085#1080#1102)
    Categories.ItemsVisibles = (
      2)
    Categories.Visibles = (
      True)
    DockColor = clBtnFace
    ImageOptions.Images = DMInv.cxSmallImages
    PopupMenuLinks = <>
    UseSystemFont = True
    Left = 73
    Top = 130
    DockControlHeights = (
      0
      0
      26
      0)
    object brTop: TdxBar
      AllowClose = False
      AllowCustomizing = False
      AllowQuickCustomizing = False
      AllowReset = False
      Caption = #1042#1099#1073#1086#1088' '#1082#1083#1072#1089#1089#1085#1086#1075#1086' '#1078#1091#1088#1085#1072#1083#1072
      CaptionButtons = <>
      DockedDockingStyle = dsTop
      DockedLeft = 0
      DockedTop = 0
      DockingStyle = dsTop
      FloatLeft = 714
      FloatTop = 320
      FloatClientWidth = 108
      FloatClientHeight = 79
      IsMainMenu = True
      ItemLinks = <
        item
          Visible = True
          ItemName = 'liYear'
        end
        item
          Visible = True
          ItemName = 'liPeriods'
        end
        item
          Visible = True
          ItemName = 'liSubject'
        end
        item
          Visible = True
          ItemName = 'liClass'
        end
        item
          Visible = True
          ItemName = 'bEditProg'
        end>
      MultiLine = True
      NotDocking = [dsNone, dsLeft, dsTop, dsRight, dsBottom]
      OneOnRow = True
      Row = 0
      UseOwnFont = False
      UseRecentItems = False
      Visible = True
      WholeRow = True
    end
    object dxbrBar1: TdxBar
      AllowClose = False
      AllowCustomizing = False
      AllowQuickCustomizing = False
      AllowReset = False
      Caption = #1059#1088#1086#1082
      CaptionButtons = <>
      DockControl = dxBarDockControl1
      DockedDockControl = dxBarDockControl1
      DockedLeft = 0
      DockedTop = 0
      FloatLeft = 521
      FloatTop = 257
      FloatClientWidth = 0
      FloatClientHeight = 0
      ItemLinks = <
        item
          Visible = True
          ItemName = 'bAddLesson'
        end
        item
          Visible = True
          ItemName = 'bDelLesson'
        end>
      NotDocking = [dsNone, dsLeft, dsTop, dsRight, dsBottom]
      OneOnRow = True
      Row = 0
      UseOwnFont = False
      UseRecentItems = False
      Visible = True
      WholeRow = True
    end
    object cbSubject: TdxBarCombo
      Caption = #1053#1086#1074#1099#1081' '#1101#1083#1077#1084#1077#1085#1090
      Category = 0
      Hint = #1053#1086#1074#1099#1081' '#1101#1083#1077#1084#1077#1085#1090
      Visible = ivAlways
      Width = 100
      ShowEditor = False
      ItemIndex = -1
    end
    object lTeacher: TdxBarStatic
      Caption = #1048#1084#1103' '#1087#1086#1083#1100#1079#1086#1074#1072#1090#1077#1083#1103
      Category = 0
      Hint = #1048#1084#1103' '#1087#1086#1083#1100#1079#1086#1074#1072#1090#1077#1083#1103
      Visible = ivAlways
    end
    object clb: TdxBarLookupCombo
      Caption = #1053#1086#1074#1099#1081' '#1101#1083#1077#1084#1077#1085#1090
      Category = 0
      Hint = #1053#1086#1074#1099#1081' '#1101#1083#1077#1084#1077#1085#1090
      Visible = ivAlways
      Glyph.Data = {
        F6000000424DF600000000000000760000002800000010000000100000000100
        0400000000008000000000000000000000001000000000000000000000000000
        8000008000000080800080000000800080008080000080808000C0C0C0000000
        FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00DDDDDDDDDDDD
        DDDD000000000000000D0FFFF0FFFFFFFF0D0F77F0F777777F0D0CCCC0CCCCCC
        CC0D0C77C0C777777C0D0CCCC0CCCCCCCC0D0F77F0F777777F0D0FFFF0FFFFFF
        FF0D0F77F0F777777F0D0FFFF0FFFFFFFF0D000000000000000D0FFFCCCCFFF0
        DDDD0F777777FFF0DDDD0FFFCCCCFFF0DDDD000000000000DDDD}
      Width = 100
      RowCount = 7
    end
    object CustomdxBarCombo1: TCustomdxBarCombo
      Caption = #1053#1086#1074#1099#1081' '#1101#1083#1077#1084#1077#1085#1090
      Category = 0
      Hint = #1053#1086#1074#1099#1081' '#1101#1083#1077#1084#1077#1085#1090
      Visible = ivAlways
      Width = 100
    end
    object liSubject: TdxBarListItem
      Caption = #1055#1088#1077#1076#1084#1077#1090
      Category = 0
      Description = #1055#1088#1077#1076#1084#1077#1090
      Visible = ivAlways
      OnClick = liSubjectClick
      ShowNumbers = False
    end
    object liClass: TdxBarListItem
      Caption = #1055#1086#1076#1088#1072#1079#1076#1077#1083#1077#1085#1080#1077
      Category = 0
      Enabled = False
      Visible = ivAlways
      OnClick = liClassClick
      ShowNumbers = False
    end
    object dxBarCombo1: TdxBarCombo
      Caption = #1053#1086#1074#1099#1081' '#1101#1083#1077#1084#1077#1085#1090
      Category = 0
      Hint = #1053#1086#1074#1099#1081' '#1101#1083#1077#1084#1077#1085#1090
      Visible = ivAlways
      Width = 100
      ItemIndex = -1
    end
    object liYear: TdxBarListItem
      Caption = #1059#1095#1077#1073#1085#1099#1081' '#1075#1086#1076
      Category = 0
      Description = #1059#1095#1077#1073#1085#1099#1081' '#1075#1086#1076
      Visible = ivAlways
      OnClick = liYearClick
      ShowNumbers = False
    end
    object bEditProg: TdxBarButton
      Caption = #1055#1088#1086#1075#1088#1072#1084#1084#1099
      Category = 0
      Hint = #1055#1088#1086#1075#1088#1072#1084#1084#1099
      Visible = ivAlways
      DropDownEnabled = False
      OnClick = bEditProgClick
    end
    object bAddLesson: TdxBarButton
      Caption = #1044#1086#1073#1072#1074#1080#1090#1100' '#1091#1088#1086#1082
      Category = 0
      Hint = #1044#1086#1073#1072#1074#1080#1090#1100' '#1091#1088#1086#1082
      Visible = ivAlways
      ImageIndex = 41
      OnClick = bAddClick
    end
    object bDelLesson: TdxBarButton
      Caption = #1059#1076#1072#1083#1080#1090#1100' '#1091#1088#1086#1082
      Category = 0
      Hint = #1059#1076#1072#1083#1080#1090#1100' '#1091#1088#1086#1082
      Visible = ivAlways
      ImageIndex = 46
      OnClick = bDelLessonClick
    end
    object liPeriods: TdxBarListItem
      Caption = #1042#1089#1077' '#1087#1077#1088#1080#1086#1076#1099
      Category = 0
      Description = #1059#1095#1077#1073#1085#1099#1081' '#1087#1077#1088#1080#1086#1076
      Visible = ivAlways
      OnClick = liPeriodsClick
      ShowNumbers = False
    end
  end
  object qSubjects: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select'
      '  s.sdid,'
      '  s.sdname'
      'from sys_dic s'
      'where s.sdparid = 35 and s.sdisdelete = 0'
      'order by s.sdname')
    Left = 89
    Top = 196
    qoStartTransaction = True
  end
  object qPlanLessons: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select *'
      'from CJ_LOAD_LESSONS(:SUBJECT_ID,:LYEAR,:PROGRAM_ID)')
    Left = 169
    Top = 137
    qoStartTransaction = True
  end
  object qSetDate: TpFIBQuery
    Transaction = DMInv.trFibWrite
    Database = DMInv.db
    SQL.Strings = (
      'EXECUTE PROCEDURE CJ_PLAN_LESSON(:PTID,:LDATE,:LYEAR)')
    Left = 169
    Top = 233
    qoAutoCommit = True
    qoStartTransaction = True
  end
  object qListPodrazd: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'SELECT'
      '  distinct'
      '  sd.sdid,'
      '  SD.SDNAME,'
      
        '  (SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1411)' +
        '),'
      
        '  (SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1412)' +
        '),'
      
        '  (SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1413)' +
        ')'
      'FROM DETI_PODRAZD_SC D'
      'JOIN SPEC_COND SC ON SC.SCID = D.SCID'
      '--JOIN AGR_POLUCH_USLUG PU ON PU.AGID = SC.AGID'
      'JOIN SYS_DIC SD ON SD.SDID = D.SDID'
      'WHERE --CURRENT_DATE BETWEEN D.DPDATEIN AND D.DPDATEOUT'
      '  --and d.dptype = 1'
      '  --and'
      
        '   (((SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,14' +
        '11)) >= 0)'
      
        '  OR ((SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1' +
        '412)) >= 0)'
      
        '  OR ((SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1' +
        '413)) >= 0))'
      'order by 5,4,3,sd.sdname'
      ''
      '/*SELECT'
      '  distinct'
      '  sd.sdid,'
      '  SD.SDNAME,'
      
        '  (SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1411)' +
        '),'
      
        '  (SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1412)' +
        '),'
      
        '  (SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1413)' +
        ')'
      'FROM DETI_PODRAZD_SC D'
      'JOIN SPEC_COND SC ON SC.SCID = D.SCID'
      'JOIN AGR_POLUCH_USLUG PU ON PU.AGID = SC.AGID'
      'JOIN SYS_DIC SD ON SD.SDID = D.SDID'
      'WHERE CURRENT_DATE BETWEEN D.DPDATEIN AND D.DPDATEOUT'
      '  and d.dptype = 1'
      
        '  and (((SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID' +
        ',1411)) >= 0)'
      
        '  OR ((SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1' +
        '412)) >= 0)'
      
        '  OR ((SELECT O$NESTING_LEVEL FROM GET_SD_NESTING_LEVEL(D.SDID,1' +
        '413)) >= 0))'
      'order by 5,4,3,sd.sdname*/')
    Left = 233
    Top = 345
    qoStartTransaction = True
  end
  object qKids: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'SELECT'
      '  distinct'
      '  p.pid,'
      '  case when p.ppatronymic is null then'
      '    p.plastname || '#39' '#39' || substring(p.pname from 1 for 1) || '#39'.'#39
      '  else'
      
        '    p.plastname || '#39' '#39' || substring(p.pname from 1 for 1) || '#39'.'#39 +
        ' || substring(p.ppatronymic from 1 for 1) || '#39'.'#39
      '  end'
      'FROM DETI_PODRAZD_SC D'
      'JOIN SPEC_COND SC ON SC.SCID = D.SCID'
      'join agr_poluch_uslug ag on ag.agid = sc.agid'
      'join people p on p.pid = ag.pid'
      'WHERE D.sdid = :CLASS_ID'
      '  and ((sc.scisdelete is null) or (sc.scisdelete = 0))'
      '  AND '
      '  ((D.DPDATEIN <= :DPDATEOUT) AND (D.DPDATEOUT >= :DPDATEIN))'
      'order by p.plastname, p.pname, p.ppatronymic')
    Left = 297
    Top = 345
    qoStartTransaction = True
  end
  object qCheckWorkDay: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select WDISHOLIDAY from WORKDAYS where wddate = :cdate')
    Left = 257
    Top = 137
    qoStartTransaction = True
  end
  object qMarks: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select'
      '  m.MARK_VALUE_id,'
      '  m.MARK_DATE,'
      '  m.pupil_id,'
      '  m.lesson_id,'
      '  m.teacher_id,'
      '  m.mark_type_id,'
      '  mv.mvshort'
      'from CJ_MARK m'
      'join agr_poluch_uslug ag on ag.pid = m.pupil_id'
      'join spec_cond sc on sc.agid = ag.agid'
      'join deti_podrazd_sc d on SC.SCID = D.SCID'
      'join podtemauk pt on pt.idpodtemauk = m.lesson_id'
      'join temauk tu on tu.idtemauk = pt.idtemauk'
      'join cj_mark_value mv on mv.mvid = m.mark_value_id'
      
        'join cj_planned_lesson pl on pl.ptid = m.lesson_id and pl.lyear ' +
        '= :LYEAR'
      'where tu.iduchebkurs = :PROGRAM_ID'
      '  and m.subject_id = :SUBJECT_ID'
      '  and D.sdid = :CLASS_ID'
      '  and ((sc.scisdelete is null) or (sc.scisdelete = 0))'
      '  AND '
      '  ((D.DPDATEIN <= :DPDATEOUT) AND (D.DPDATEOUT >= :DPDATEIN))'
      '  and pt.pisdelete is null'
      '  and tu.tisdelete is null'
      ''
      'union'
      ''
      'select'
      '  m.MARK_VALUE_id,'
      '  m.MARK_DATE,'
      '  m.pupil_id,'
      '  m.lesson_id,'
      '  m.teacher_id,'
      '  m.mark_type_id,'
      '  mv.mvshort'
      'from CJ_MARK m'
      'join agr_poluch_uslug ag on ag.pid = m.pupil_id'
      'join spec_cond sc on sc.agid = ag.agid'
      'join deti_podrazd_sc d on SC.SCID = D.SCID'
      'join cj_mark_value mv on mv.mvid = m.mark_value_id'
      
        'join cj_planned_lesson pl on pl.ptid = m.lesson_id and pl.lyear ' +
        '= :LYEAR'
      'where :PROGRAM_ID = 0'
      '  and m.subject_id = :SUBJECT_ID'
      '  and D.sdid = :CLASS_ID'
      '  and ((sc.scisdelete is null) or (sc.scisdelete = 0))'
      '  AND '
      '  ((D.DPDATEIN <= :DPDATEOUT) AND (D.DPDATEOUT >= :DPDATEIN))'
      ''
      'union'
      ''
      'select'
      '  x.MARK_VALUE_id,'
      '  x.MARK_DATE,'
      '  x.pupil_id,'
      '  0,'
      '  x.teacher_id,'
      '  -f.fid,'
      '  mv.mvshort'
      'from cj_finalmark x'
      'join agr_poluch_uslug ag on ag.pid = x.pupil_id'
      'join spec_cond sc on sc.agid = ag.agid'
      'join deti_podrazd_sc d on SC.SCID = D.SCID'
      'join cj_final f on x.fid = f.fid'
      'join cj_period p on p.prid = f.fprid'
      'join cj_mark_value mv on mv.mvid = x.mark_value_id'
      'where x.subject_id = :SUBJECT_ID'
      '  and D.sdid = :CLASS_ID'
      '  and ((sc.scisdelete is null) or (sc.scisdelete = 0))'
      '  and x.lyear = :LYEAR'
      '  AND'
      '  ((D.DPDATEIN <= :DPDATEOUT) AND (D.DPDATEOUT >= :DPDATEIN))')
    Left = 441
    Top = 313
    qoStartTransaction = True
  end
  object qLessonList: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select *'
      'from CJ_LOAD_COLUMNS(:SUBJECT_ID,:PROGRAM_ID,:CLASS_ID,:LYEAR)')
    Left = 513
    Top = 233
    qoStartTransaction = True
  end
  object qMarksAdd: TpFIBQuery
    Transaction = DMInv.trFibWrite
    Database = DMInv.db
    SQL.Strings = (
      'EXECUTE PROCEDURE CJ_SET_MARK'
      '  (:SUBJECT_ID,'
      '   :LESSON_ID,'
      '   :TEACHER_ID,'
      '   :PUPIL_ID,'
      '   :MARK_TYPE_ID,'
      '   :mark_value_id,'
      '   :LYEAR)')
    Left = 497
    Top = 313
    qoAutoCommit = True
    qoStartTransaction = True
  end
  object qPrograms: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      
        'select distinct KID,KSTR from CJ_LOAD_LESSONS(:SUBJECT_ID,:LYEAR' +
        ') where KSTR is not null')
    Left = 169
    Top = 185
    qoStartTransaction = True
  end
  object qClassProgram: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select PROGRAM_ID'
      'from CJ_CLASS_PROGRAM'
      'where CLASS_ID = :CLASS_ID '
      '  and SUBJECT_ID = :SUBJECT_ID')
    Left = 353
    Top = 137
    qoStartTransaction = True
  end
  object qMarkType: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select * from CJ_MARK_VALUE order by mvsortorder')
    Left = 505
    Top = 145
    qoStartTransaction = True
  end
  object qThemeList: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select *'
      'from CJ_LOAD_LESSONS(:SUBJECT_ID,:LYEAR)'
      'where kid = :PROGRAM_ID and ((LDATE IS NULL) OR (:LOADANY > 0))'
      'order by LDATE')
    Left = 585
    Top = 234
    qoStartTransaction = True
  end
  object qMarkControl: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      
        'select mtid, mtlong, mtshort, mtsortorder from CJ_MARK_TYPE orde' +
        'r by mtsortorder')
    Left = 441
    Top = 193
    qoStartTransaction = True
  end
  object qListYear: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      '/*select distinct LYEAR'
      'from CJ_PLANNED_LESSON'
      ''
      'union*/'
      ''
      'select'
      '  case when (EXTRACT (MONTH FROM CURRENT_DATE) < 6) then'
      '    (EXTRACT (YEAR FROM CURRENT_DATE))-1'
      '  else'
      '    (EXTRACT (YEAR FROM CURRENT_DATE))'
      '  end'
      'from rdb$database'
      ''
      'order by 1 desc')
    Left = 249
    Top = 265
    qoStartTransaction = True
  end
  object qMaxDate: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select MAX(LDATE)'
      'from CJ_LOAD_LESSONS(:SUBJECT_ID,:LYEAR)'
      'where kid = :PROGRAM_ID')
    Left = 622
    Top = 171
    qoStartTransaction = True
  end
  object qPeriods: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select PRNAME,PRBEGIN,PREND'
      'from cj_period'
      'where (prtype = :PRTYPE) or (:PRTYPE = 0)'
      'order by prid')
    Left = 136
    Top = 312
    qoStartTransaction = True
  end
  object qKidPodrazd: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'SELECT'
      '  distinct'
      '  D.DPDATEIN,'
      '  D.DPDATEOUT'
      'FROM DETI_PODRAZD_SC D'
      'JOIN SPEC_COND SC ON SC.SCID = D.SCID'
      'join agr_poluch_uslug ag on ag.agid = sc.agid'
      'WHERE ag.pid = :PID '
      '  and D.sdid = :CLASS_ID'
      '  and ((sc.scisdelete is null) or (sc.scisdelete = 0))'
      '  AND '
      '  ((D.DPDATEIN <= :DPDATEOUT) AND (D.DPDATEOUT >= :DPDATEIN))'
      'ORDER BY D.DPDATEIN, D.DPDATEOUT')
    Left = 345
    Top = 345
    qoStartTransaction = True
  end
  object qDummyLesson: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select PTID'
      'from CJ_PLANNED_LESSON'
      'where LDate = :LDATE'
      '  and LYear = :LYEAR')
    Left = 161
    Top = 417
    qoStartTransaction = True
  end
  object qAddDummy: TpFIBQuery
    Transaction = DMInv.trFibWrite
    Database = DMInv.db
    SQL.Strings = (
      'SELECT NLID FROM CJ_NEW_LESSON(:LDATE,:LYEAR)')
    Left = 161
    Top = 465
    qoStartTransaction = True
  end
  object qDummyColumns: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select'
      '  mt.mtid,'
      '  mt.mtshort'
      'from cj_mark_type mt'
      'where mt.mtsortorder = 1'
      ''
      'union'
      ''
      'select'
      '  m.mark_type_id,'
      '  mt.mtshort'
      'from CJ_MARK m'
      'join agr_poluch_uslug ag on ag.pid = m.pupil_id'
      'join spec_cond sc on sc.agid = ag.agid'
      'join deti_podrazd_sc d on SC.SCID = D.SCID'
      'join cj_mark_value mv on mv.mvid = m.mark_value_id'
      
        'join cj_planned_lesson pl on pl.ptid = m.lesson_id and pl.lyear ' +
        '= :LYEAR'
      'join cj_mark_type mt on mt.mtid = m.mark_type_id'
      'where m.subject_id = :SUBJECT_ID'
      '  and D.sdid = :CLASS_ID'
      '  and ((sc.scisdelete is null) or (sc.scisdelete = 0))'
      '  and m.lesson_id = :LESSON_ID'
      '  AND '
      '    ((D.DPDATEIN BETWEEN :DPDATEIN AND :DPDATEOUT) OR'
      '    (D.DPDATEOUT BETWEEN :DPDATEIN AND :DPDATEOUT))')
    Left = 97
    Top = 441
    qoStartTransaction = True
  end
  object qFinals: TpFIBQuery
    Transaction = DMInv.trFibRead
    Database = DMInv.db
    SQL.Strings = (
      'select'
      '  f.fid,'
      '  case when f.fname is null then'
      '    p.prname'
      '  else'
      '    f.fname'
      '  end as "fname",'
      '  f.fparal,'
      '  p.prend'
      'from CJ_FINAL f'
      'left join CJ_PERIOD p on p.prid = f.fprid'
      'where (p.prid is null) or (prtype = :PRTYPE) or (:PRTYPE = 0)'
      'order by f.fsort_order')
    Left = 64
    Top = 344
    qoStartTransaction = True
  end
end
